package cn.lcsjsxy.yxc.enumclass;

/**
 * 二、使用enum关键字来定义枚举类
 * 说明：定义的枚举类默认继承于java.long.Enum类
 */
public class SeasonTest1 {
    public static void main(String[] args) {
        Season1 summer=Season1.SUMMER;
        System.out.println(Season1.class);
        System.out.println(summer);
        summer.show();
    }
}

interface Info{
    void show();
}

enum Season1 implements Info{
    //1.提供当前枚举类的对象，多个对象之间用","隔开，末尾对象用";"结束
    SPRING("春天","春暖花开"){
        @Override
        public void show() {
            System.out.println("这是春天");
        }
    },
    SUMMER("夏天","夏日炎炎"){
        @Override
        public void show() {
            System.out.println("这是夏天");
        }
    },
    AUTUMN("秋天","秋高气爽"){
        @Override
        public void show() {
            System.out.println("这是秋天");
        }
    },
    WINTER("冬天","寒风凛冽"){
        @Override
        public void show() {
            System.out.println("这是冬天");
        }
    };
    //2.声明Season对象的属性：private final修饰
    private final String seasonName;
    private final String seasonDesc;
    //3.私有化类的构造器，并给对象属性赋值
    private Season1(String seasonName,String seasonDesc){
        this.seasonName=seasonName;
        this.seasonDesc=seasonDesc;
    }
    //4.其他需求


    public String getSeasonDesc() {
        return seasonDesc;
    }

    public String getSeasonName() {
        return seasonName;
    }
}
